package com.li.network.lab_4;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.concurrent.ExecutorService;

public class ProxyServer {

    public static void main(String[] args) {
        int port = 8888;
        ExecutorService service = SingleThreadPool.getService();
        try (ServerSocket server = new ServerSocket(port)) {
            while (true) {
                Socket socket = server.accept();
                System.out.println("建立连接！");
                ConnectThread connectThread = new ConnectThread(socket);
                service.execute(connectThread);
            }
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}
